package model

import "time"

//订单表

type Order struct {
	BaseModel
	OrderSc     string `form:"order_sc" json:"order_sc"  gorm:"not null;comment:订单号"`
	UserId      uint   `form:"user_id" json:"user_id" gorm:"not null;default:0;comment:用户表user主键id"`
	AddressId   uint   `form:"address_id" json:"address_id" gorm:"not null;default:0;comment:用户收货表user_address主键id"`
	OrderStatus uint   `form:"order_status" json:"order_status" gorm:"type:tinyint(1);default:1;comment:订单状态  0未知 1 已下单 2 已收货 3 已取消 4 已完成|评价完 5 已作废"`

	ShipStatus uint   `form:"ship_status" json:"ship_status" gorm:"type:tinyint(1);default:1;comment:发货状态 0未知  1未发货 2 已发货 3 部分发货"`
	ShipCode   string `form:"ship_code" json:"ship_code"  gorm:"size:50;comment:物流code"`
	ShipName   string `form:"ship_name" json:"ship_name"  gorm:"size:30;comment:物流名称"`

	PayStatus uint   `form:"pay_status" json:"pay_status" gorm:"type:tinyint(1);default:1;comment:支付状态 0未知  1未支付 2 已支付 3部分支付 4 已退款 5 拒绝退款"`
	PayCode   string `form:"pay_code" json:"pay_code"  gorm:"comment:支付code"`
	PayWay    string `form:"pay_way" json:"pay_way"  gorm:"type:tinyint(1);default:0;comment:支付方式 0 未知 1 微信支付 2 支付宝支付 3数字人民币 4其它"`

	InvoiceTitle string `form:"invoice_title" json:"invoice_title"  gorm:"comment:发票抬头"`
	Taxpayer     string `form:"taxpayer" json:"taxpayer"  gorm:"size:30;comment:纳税人识别号"`

	GoodsTotalAmount float64 `form:"goods_total_amount" json:"goods_total_amount" gorm:"type:decimal(10,2) not null;default:0.00;comment:商品总价"`
	FreightPrice     float64 `form:"freight_price" json:"freight_price" gorm:"type:decimal(10,2) not null;default:0.00;comment:邮费"`
	UseShopWallet    float64 `form:"use_shop_wallet" json:"use_shop_wallet" gorm:"type:decimal(10,2) not null;default:0.00;comment:使用商城钱包"`
	CouponPrice      float64 `form:"coupon_price" json:"coupon_price" gorm:"type:decimal(10,2) not null;default:0.00;comment:优惠券抵扣"`
	Integral         uint    `form:"integral" json:"integral" gorm:"default:0;comment:使用积分抵扣/兑换"`
	IntegralPrice    float64 `form:"integral_price" json:"integral_price" gorm:"type:decimal(10,2) not null;default:0.00;comment:使用积分抵多少钱"`

	OrderTotalAmount  float64 `form:"order_total_amount" json:"order_total_amount" gorm:"type:decimal(10,2) not null;default:0.00;comment:订单总价"`
	OrderPayablePrice float64 `form:"order_payable_amount" json:"order_payable_amount" gorm:"type:decimal(10,2) not null;default:0.00;comment:订单应付款金额"`

	ShipTime           time.Time `form:"ship_time" json:"ship_time"  gorm:"comment:最新发货时间"`
	ConfirmReceiptTime time.Time `form:"confirm_receipt_time" json:"confirm_receipt_time"  gorm:"comment:收货确认时间"`
	PayTime            time.Time `form:"pay_time" json:"pay_time"  gorm:"comment:支付时间"`
	TransactionId      string    `form:"transaction_id" json:"transaction_id"  gorm:"comment:加密第三方平台交易流水号"`

	PromType        uint    `form:"prom_type" json:"prom_type" gorm:"type:tinyint(1) not null;default:0;comment:订单类型0 普通订单,1 限时抢购, 2 团购 , 3 促销优惠"`
	PromId          uint    `form:"prom_id" json:"prom_id" gorm:"not null;default:0;comment:活动id"`
	OrderPromId     uint    `form:"order_prom_id" json:"order_prom_id" gorm:"type:smallint(6) not null;default:0;comment:活动id"`
	OrderPromAmount float64 `form:"order_prom_amount" json:"order_prom_amount" gorm:"type:decimal(10,2) not null;default:0.00;comment:活动优惠金额"`
	Discount        float64 `form:"discount" json:"discount" gorm:"type:decimal(10,2) not null;default:0.00;comment:价格调整"`

	UserNote string `form:"user_note" json:"user_note" gorm:"comment:用户备注"`
	AuthId   uint   `form:"auth_id" json:"auth_id" gorm:"not null;default:0;comment:管理员表auth主键id"`
	AuthNote string `form:"auth_note" json:"auth_note" gorm:"comment:管理员备注"`
}

//几个状态，需要重构
